<template>
  <div class="com-b">
    <h1>B组件</h1>
    <button @click="fn">B传值A</button>
  </div>
</template>

<script>
import eventBus from '@/eventBus'
  export default {
    name: 'com-b',
    data() {
        return {
            msg:'com-b组件数据'
        }
    },
    methods: {
        fn(){
      //传递数据 
      eventBus.$emit('b2a',this.msg)
        }
    },
  }
</script>

<style>

</style>